package cn.fzkj.router04;

import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.Props;
import cn.fzkj.inbox03.InboxTest;

import static cn.fzkj.router04.RouterTest.flag;

/**
 * @ author mr
 * @ description
 * @ since 2024/12/2
 */
public class Main04 {

    public static void main(String[] args) throws InterruptedException {
        ActorSystem system = ActorSystem.create("strategy");
        ActorRef routerTest = system.actorOf(Props.create(RouterTest.class), "RouterTest");

        int i = 1;
        while(flag.get()){
            routerTest.tell(InboxTest.Msg.WORKING, ActorRef.noSender());

            if(i % 10 == 0) routerTest.tell(InboxTest.Msg.CLOSE, ActorRef.noSender());

            Thread.sleep(500);

            i ++;
        }
    }
}
